package com.ruoyi.back.controller

import com.ruoyi.app.common.Data
import com.ruoyi.back.domain.AdvertisingSetting
import com.ruoyi.back.service.impl.AdvertisingSettingService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/system/advertisingSetting")
@Api(tags = ["开屏广告设置"])
class AdvertisingSettingController {

    @Autowired
    private lateinit var advertisingSettingService: AdvertisingSettingService

    @ApiOperation("保存广告设置")
    @PostMapping("save")
    fun saveAdvertisingSetting(@RequestBody advertisingSetting: AdvertisingSetting) =
        advertisingSettingService.saveAdvertisingSetting(advertisingSetting)

    @ApiOperation("获取广告设置")
    @GetMapping("get")
    fun getAdvertisingSetting(advertisingType: Int): Data<AdvertisingSetting> =
        advertisingSettingService.getAdvertisingSetting(advertisingType)
}